home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6207 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  874 b 

  1. Path: news.clark.net!usenet
  2. From: yom@clark.net (yom)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How do I use abs() on floats ?
  5. Date: 23 Feb 1996 03:04:44 GMT
  6. Organization: Your Organization
  7. Message-ID: <4gjasc$dgp@clarknet.clark.net>
  8. References: <4ghki0$b44@LNCSEX0003.eu.btco.com>
  9. NNTP-Posting-Host: yom.clark.net
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.7
  13.  
  14. double fabs(double)
  15.  
  16. Song (yom@clark.net)
  17.  
  18. In article <4ghki0$b44@LNCSEX0003.eu.btco.com>, DaveMx says...
  19. >
  20. >What's the easiest way to get the absolute scalar value of a float.
  21. >I need to test to see of a variable is 'bigger' than a certain 
  22. tolerance.
  23. >
  24. >e.g.
  25. >
  26. >if ( abs (error__float)  > MAX_TOLERANCE )   printf ( "Tolerance level 
  27. exceeded \n" );
  28. >
  29. >
  30. >BUT the abs() function says it only works on int 's . Any ideas how to 
  31. do it for floats in the most elegant way ???
  32.  
  33.